import java.util.Scanner;

// 定义银行接口
interface IBank {
    double withdraw(double money);
}

// 工商银行实现类
class ICBC implements IBank {
    @Override
    public double withdraw(double money) {
        return money * (1 + 0.001);
    }
}

// 农业银行实现类
class ABC implements IBank {
    @Override
    public double withdraw(double money) {
        return money * (1 + 0.002);
    }
}

// 客户类
class Customer {
    public double getMoneyFromBank(IBank bank, double money) {
        return bank.withdraw(money);
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String bankName = scanner.next();
        double money = scanner.nextDouble();

        Customer customer = new Customer();
        double result;
        if ("ICBC".equals(bankName)) {
            result = customer.getMoneyFromBank(new ICBC(), money);
        } else if ("ABC".equals(bankName)) {
            result = customer.getMoneyFromBank(new ABC(), money);
        } else {
            result = 0;
        }

        System.out.println(Math.round(result));
        scanner.close();
    }
}